﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Utils.Extention;
#region Version Info
/* ========================================================================
* 【本页面功能概述】
*
* 作者：wangjianfeng 创建时间：2012/9/23 15:52:57
* 文件名：AjaxStatus.cs
*
* 修改者： 时间：
* 修改说明：
* ========================================================================
*/
#endregion
namespace ChinaLeg.Web.WebAdmin.News
{
    /// <summary>
    /// AjaxStatus 的摘要说明
    /// </summary>
    public class AjaxStatus : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            if (!context.Request.QueryString["id"].ToTrim().IsNullOrEmpty())
            {
                int id = context.Request.QueryString["id"].ToInt32();
                int type = context.Request.QueryString["type"].ToInt32();

                ChinaLeg.Model.News model = ChinaLeg.BLL.News.Instance.GetModel(id);
                switch (type)
                {
                    case 1:
                        model.IndexCommend = model.IndexCommend == 0 ? 1 : 0;
 
                        break;
                    case 2:
                        model.ListCommend = model.ListCommend == 0 ? 1 : 0;
                        break;
                    case 3:
                        model.DetailsCommend = model.DetailsCommend == 0 ? 1 : 0;
                        break;
                }
                ChinaLeg.BLL.News.Instance.Update(model);
                context.Response.Write("1");
            }
        }


        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}